﻿using HAF.LogUtility;
using System;
using System.ComponentModel;
using System.IO;
using System.Text;

namespace WcfAdvice
{
    public class PubClass
    {
        /// <summary>
        /// 获取流数据
        /// </summary>
        /// <param name="stream"></param>
        /// <returns></returns>
        [DisplayName("获取流数据")]
        public static string GetStreamData(Stream stream)
        {
            try
            {
                string inStr = string.Empty;
                Stream inStream = stream;
                using (StreamReader sr = new StreamReader(inStream, Encoding.UTF8))
                {
                    inStr = sr.ReadToEnd();
                }

                return inStr;
            }
            catch (Exception ex)
            {
                LogHelper.WriteErrorLogEx(ex.ToString());
                return string.Empty;
                //throw new SrvException(AuthCode.ParseErr);
            }
        }
    }
}